<template>
	<div>
		<h2>这是父组件</h2><button @click="tozi">点我跳子组件</button>
		父传子<zi :listdata="list"></zi>
		<zi @sendto="get"></zi>
		<h4>{{text}}</h4>
	</div>
</template>

<script>
	import zi from "../components/zi.vue"
	export default{
		data(){
			return{
				list:[
					{
						id:Math.random().toFixed(5),
						name:Math.random().toFixed(5),
					},
					{
						id:Math.random().toFixed(5),
						name:Math.random().toFixed(5),
					},
					{
						id:Math.random().toFixed(5),
						name:Math.random().toFixed(5),
					},
				],
				text:"",
			}
		},
		components:{
			zi,
		},
		methods:{
			get:function(nval){
				// console.log(nval);
				this.text=nval;
			},
			tozi:function(){
				this.$router.push("/zi");
			}
		}
	}
</script>

<style>
</style>
